package com.ruoyi.jeeplus.modules.screen.screen_PV.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.jeeplus.modules.screen.screen_PV.domain.screen_PV;
import com.ruoyi.jeeplus.modules.screen.screen_PV.service.Iscreen_PVService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 光伏Controller
 * 
 * @author LAYH
 * @date 2024-10-20
 */
@RestController
@RequestMapping("/screen_PV/screen_PV")
public class screen_PVController extends BaseController
{
    @Autowired
    private Iscreen_PVService screen_PVService;

    /**
     * 查询光伏列表
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:list')")
    @GetMapping("/list")
    public TableDataInfo list(screen_PV screen_PV)
    {
        startPage();
        List<screen_PV> list = screen_PVService.selectscreen_PVList(screen_PV);
        return getDataTable(list);
    }

    /**
     * 导出光伏列表
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:export')")
    @Log(title = "光伏", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, screen_PV screen_PV)
    {
        List<screen_PV> list = screen_PVService.selectscreen_PVList(screen_PV);
        ExcelUtil<screen_PV> util = new ExcelUtil<screen_PV>(screen_PV.class);
        util.exportExcel(response, list, "光伏数据");
    }

    /**
     * 获取光伏详细信息
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(screen_PVService.selectscreen_PVById(id));
    }

    /**
     * 新增光伏
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:add')")
    @Log(title = "光伏", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody screen_PV screen_PV)
    {
        return toAjax(screen_PVService.insertscreen_PV(screen_PV));
    }

    /**
     * 修改光伏
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:edit')")
    @Log(title = "光伏", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody screen_PV screen_PV)
    {
        return toAjax(screen_PVService.updatescreen_PV(screen_PV));
    }

    /**
     * 删除光伏
     */
    @PreAuthorize("@ss.hasPermi('screen_PV:screen_PV:remove')")
    @Log(title = "光伏", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(screen_PVService.deletescreen_PVByIds(ids));
    }
}
